package com.supor.aiot.mine.ui.adapter;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.supor.aiot.mine.R;
import com.supor.aiot.mine.bean.Dictionary;

import org.jetbrains.annotations.NotNull;

import java.util.List;

/**
 * ---------------------------------------------------------------- <br>
 * Copyright (C) 2014-2020, by het, Shenzhen, All rights reserved.  <br>
 * ---------------------------------------------------------------- <br>
 * <p>
 * 描述: DeviceAdapter <br>
 * 作者: lei <br>
 * 日期: 2021/7/16 <br>
 */
public class DictionaryAdapter extends BaseQuickAdapter<Dictionary, BaseViewHolder> {

    public DictionaryAdapter(List<Dictionary> dataList) {
        super(R.layout.item_dictionary, dataList);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, Dictionary data) {
        TextView text = holder.itemView.findViewById(R.id.tv_name);
        text.setText(data.dictionaryBean.getCnName());
        if (data.isSelect) {
            holder.itemView.setSelected(true);
            text.setTextColor(holder.itemView.getResources().getColor(R.color.colorPrimary));
        } else {
            holder.itemView.setSelected(false);
            text.setTextColor(holder.itemView.getResources().getColor(R.color.content_default));
        }

    }
}
